<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
	<jsp:include page="${ctx }/WEB-INF/view/meta.jsp"></jsp:include>
	<script type="text/javascript" src="${ctx}/resource/js/admin/user.js?r=${random}"></script>
</head>
<body>
	<div class="easyui-panel" data-options="fit:true">
		<div class="easyui-panel" style="padding:10px;" 
			data-options="title:'查询条件', collapsible:true, width:'100%', height:'20%'">
			<form id="search-form" action="/admin/user/search" method="post">
				<table class="search-table">
					<tr>
						<td>
							账号：<input name="username" class="easyui-textbox search-input">
						</td>
						<td>
							姓名：<input name="truename" class="easyui-textbox search-input">
						</td>
						<td>
							<a href="javascript:User.search()" class="easyui-linkbutton search-button" data-options="iconCls:'icon-search'">搜索</a>
						</td>
					</tr>
				</table>
			</form>
		</div>
		
		<div class="easyui-panel" data-options="height:'80%',title:'查询结果'">
			<!-- DataGrid -->
			<table id="data-grid" class="easyui-datagrid" 
				data-options="fitColumns:true, singleSelect:true, fit:true, pagination:true, 
					rownumbers:true, toolbar:'#toolbar', selectOnCheck:true, pageSize:20,
					url:'/admin/user/search'">
				<thead>
			        <tr>
			        	<th data-options="field:'id', checkbox:true"></th>
			            <th data-options="field:'username'">账号</th>
			            <th data-options="field:'truename'">姓名</th>
			            <th data-options="field:'loginCount'">登陆次数</th>
			            <th data-options="field:'createAt'">创建时间</th>
			        </tr>
			    </thead>
			    <tbody></tbody>
			</table>
		</div>
		<div id="toolbar">
			<shiro:hasPermission name="/admin/user/save">
				<a href="javascript:User.beforeAdd()" class="easyui-linkbutton" data-options="iconCls:'icon-add'">新增</a>
			</shiro:hasPermission>
			<shiro:hasPermission name="/admin/user/save">
				<a href="javascript:User.beforeUpdate()" class="easyui-linkbutton" data-options="iconCls:'icon-cut'">修改</a>
			</shiro:hasPermission>
			<shiro:hasPermission name="/admin/user/delete">
				<a href="javascript:User.deleteUser()" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">删除</a>
			</shiro:hasPermission>
		</div>
	</div>
	
	<!-- Add Form -->
	<div id="add-dialog" class="easyui-dialog" style="padding:10px; width: 420px;" 
		data-options="closed:true, title:'编辑', buttons:'#add-dialog-buttons'">
		<form id="add-form" method="post" data-options="novalidate: false">
			<input type="hidden" name="id" />
			<ul class="simple-ul">
				<li>
		        	<label>账号：</label>
					<input id="username" name="username" class="easyui-textbox add-input" data-options="required:true">
		        </li>
		        <li>
		        	<label>姓名：</label>
					<input name="truename" class="easyui-textbox add-input" data-options="required:true">
		        </li>
		        <li>
		        	<label>密码：</label>
					<input type="password" id="password" name="password" class="easyui-textbox add-input" data-options="required:true">
		        </li>
		        <li>
		        	<label>确认密码：</label>
					<input type="password" id="confirmPassowrd" name="confirmPassowrd" class="easyui-textbox add-input" 
						data-options="required:true" validType="equals['#password']">
		        </li>
		        <li>
		        	<label>角色：</label>
		        	<input id="role-tree" class="add-input" name="roles">
		        </li>
	        </ul>
	    </form>
	</div>
	<div id="add-dialog-buttons" style="text-align:center;">
		<a href="javascript:User.addUser()" class="easyui-linkbutton c6 search-button" data-options="iconCls:'icon-ok'">提交</a>
    	<a href="javascript:App.closeAddDialog()" class="easyui-linkbutton search-button" data-options="iconCls:'icon-cancel'">取消</a>
	</div>
</body>
</html>